package com.highly.thread.t1;

//1. 继承thread类，重写run方法，run方法中，需要线程执行代码
class CreateTest extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.print("子id:" + this.getId() + ",");
            System.out.print("name:" + getName());
            System.out.println("..i:" + i);
            System.out.println();
        }
    }
}

public class CreateThread01 {
    public static void main(String[] args){
        System.out.println("main... 主线程开始...");
        // 1.创建线程
        CreateTest threadDemo01 = new CreateTest();
        // 2.启动线程
        threadDemo01.start();
        for (int i = 0; i < 10; i++) {
            System.out.println("main..i:" + i);
        }
        System.out.println("main... 主线程结束...");
    }
}
